package daoImpl;

import java.util.List;


import org.hibernate.Session;
import org.hibernate.Transaction;

import bean.User;
import util.HibernateSessionFactory;


public class UserDaoImpl {
	

	public boolean login(String name) {  
			Session session = HibernateSessionFactory.getSession();
		 	Transaction tx = session.beginTransaction();
	        String hql ="FROM User where username = ?" ;	       
	        org.hibernate.Query query =session.createQuery(hql);
	        query.setString(0, name);
	        List<User> list = query.list();
	        if(list != null && list.size() > 0){  
	           User user = list.get(0); 
	            return true;
	        }  
	        return false;  
	}
}
